package net.oschina.app.com.testcase.login1;

import android.widget.EditText;

import com.robotium.solo.Solo;

import net.oschina.app.BasicTest;
import net.oschina.app.Helper;

/**
 * Created by Administrator on 2018/3/9.
 *
 * 继承父类封装的重复代码，只需要写测试方法即可
 */

public class Login1 extends BasicTest {
    @Override
    public void setUp(boolean isNeedLogin) throws Exception {
        super.setUp(true);
    }

    public void testName() throws Exception {

        //根据Id定位点击“我的”
//       solo.clickOnView(solo.getView("net.oschina.app:id/nav_item_me"));
        helper.getPageNavvgation().clickMeTab();//点击“我的”
//       //根据Id定位点击“点击头像登录”
//       solo.clickOnView(solo.getView("net.oschina.app:id/iv_portrait"));
        helper.getPageMyTab().clickLoginIcon();



        helper.getPageLogin().login("Helloworld","123456");//正确账号密码：735723619@qq.com   12345678
//       //先找到用户名和密码输入框
//       EditText nameET= (EditText) solo.getView("net.oschina.app:id/et_username");
//       EditText pwdET= (EditText) solo.getView("net.oschina.app:id/et_password");
//       //先清空输入框
//        solo.clearEditText(nameET);
//        //在用户名输入框中输入“HelloWorld”
//        solo.enterText(nameET,"HelloWorld");
//        //清空密码输入框然后再输入
//        solo.clearEditText(pwdET);
//        //在密码输入框中输入“123456”
//        solo.enterText(pwdET,"123456");
//        //根据id找到登录按钮,然后点击
//        solo.clickOnView(solo.getView("net.oschina.app:id/btn_login"));
//        assertTrue(solo.searchText("用户名或口令错",true));
        assertTrue(helper.getPageCommon().searchText("用户名或口令错"));






    }


}
